package com.cetc39.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cetc39.bean.Department;
import com.cetc39.dao.DeptDao;

public class DeptDaoImpl extends HibernateDaoSupport implements DeptDao {

	@Override
	public void saveDept(Department dept) {
		this.getHibernateTemplate().save(dept);
	}

	@Override
	public void updateDept(Department dept) {
		this.getHibernateTemplate().saveOrUpdate(dept);
	}

	@Override
	public List<?> findAllDept() {
		List<?> list = this.getHibernateTemplate().find("FROM Department");
		return list;
	}

	@Override
	public Department findByDeptid(int id) {
		Department d = this.getHibernateTemplate().get(Department.class, id);
		return d;
	}

}
